home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / mikecom / xonoff.asm < prev   
Assembly Source File  |  1987-05-19  |  2KB  |  46 lines

  1.  
  2. title ENABLE/DISABLE USE OF XON/XOFF
  3. include subfx.h
  4.  
  5. ;  Mike Dumdei,  6 Holly Lane,  Texarkana TX  75503
  6.  
  7. IMPORT_NEAR     <__tx_inton>
  8.  
  9. ;****************************************************************************
  10. ; ASYNC_XONOFF -- Enables or disables use of XON/XOFF protocol.
  11. ;****************************************************************************
  12. begseg          COMM_TEXT
  13. publicproc      _async_xonoff
  14.         push    bp
  15.         mov     bp,sp
  16.         push    si              ;stack frame setup
  17.         call    __ck_port_arg   ;ck if valid, load pointers
  18.         jz      xon_exit        ;bad arg if ZR flag set
  19.         cmp     Flag,OFF        ;turning protocol off?
  20.         jne     enable_prtcl
  21. ;disable_prtcl:
  22.         cli
  23.         test    STAT2,B_XSENT   ;has an XOFF been sent?
  24.         jz      finish_disable       ;if disabling and an XOFF has been sent,
  25.         mov     TXIMMEDCHAR,XONCHAR  ;clear XOFF sent condition befr disabling
  26.         and     TX_STAT,n B_TXEMPTY ;clear the nothing to send bit
  27.         jnz     finish_disable
  28.         call    __tx_inton      ;turn tx intrpts if not on alrdy & no flw halts
  29. finish_disable:
  30.         and     STAT2,11111000b ;clear XON/OFF related bits if arg was OFF
  31.         sti
  32.         jmp s   xon_ex1
  33. enable_prtcl:
  34.         or      STAT2,B_XUSE    ;set bit to enable if arg was ON
  35.         and     STAT3,n B_XONANY ;and clr bit that allows any char to be an XON
  36. xon_ex1:
  37.         xor     ax,ax           ;return R_OK
  38. xon_exit:
  39.         pop     si
  40.         pop     bp
  41.         ret                     ;restore regs and exit
  42. _async_xonoff   endp
  43.  
  44. endseg          COMM_TEXT
  45.         end
  46.